#!/usr/bin/python
# -*- coding: UTF-8 -*-

"""
语音文字识别
"""

# 使用Google Speech Recognition API进行语音识别
import speech_recognition as sr

# 读取音频文件
r = sr.Recognizer()
audio_file = "E:\\learn\\!!!git\\20240603-1339\\tzq-learn\\小说\\女人敢问你多高，5句话暧昧拉满.wav"
with sr.AudioFile(audio_file) as source:
    audio_data = r.record(source)

# 识别音频文件
text = r.recognize_google(audio_data)

print("转换结果: " + text)